package pers.course.week9;

import java.util.*;

public class FindLongestSubstrings {
    public static int lengthOfLongestSubstring(String str) {
        int length = str.length();
        if (length == 0 || length == 1) {
            return length;
        }
        List<Character> list;
        int count = 0;
        for (int i = 0; i < length; ++i) {
            list = new ArrayList<>();
            for (int j = i; j < length; ++j) {
                if (!list.contains(str.charAt(j))) {
                    list.add(str.charAt(j));
                    count = Math.max(count, j - i + 1);
                } else {
                    break;
                }
            }
        }
        return count;
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();
        System.out.println(lengthOfLongestSubstring(str));
    }
}
